package UseFile;

public class demo01 {
    /**
     * 定义一个递归方法public static int sum(int a)，用来计算a的累加和；即从1+2+…n;
     * @param a
     * @return
     */
    public static int sum(int a){
        if(a==1){
            return 1;
        }else {
            return a + sum(a-1);
        }
    }
    public static void main(String[] args) {
        System.out.println(sum(5));
    }
}
